﻿					<script language="JavaScript">
                    function check()
                    {
                        if(document.MyForm.Subject.value=="")
                        {
                            alert("* 必须填写！");
                            document.MyForm.Subject.focus();
                            return false 
                        }
                        if(document.MyForm.Name.value=="")
                        {
                            alert("* 必须填写！");
                            document.MyForm.Name.focus()
                            return false 
                        }
                        if(document.MyForm.Tel.value=="")
                        {
                            alert("* 必须填写！");
                            document.MyForm.Tel.focus()
                            return false 
                        }
                        if(document.MyForm.message.value=="")
                        {
                            alert("* 必须填写！");
                            document.MyForm.message.focus()
                            return false 
                        }
                    }
                    </script>
<?
if($_POST['work']){
$datetim=date('Y-m-d');
echo $sql="insert into Netsys_Message (Subject,Address,Code,Name,Tel,Fax,email,DateTime,message) " .
  		"values ('$_POST[Subject]','$_POST[Address]','$_POST[Code]','$_POST[Name]','$_POST[Tel]','$_POST[Fax]','$_POST[email]','$datetim','$_POST[message]')";
    mysql_query($sql);
     echo "<script language='javascript'>"; 
     echo "alert('您的留言成功！');";
     echo " location='javascript:history.go(-1)';"; 
     echo "</script>";
}else{
?><style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
-->
</style>
<form action="" method="post" name="MyForm" id="MyForm">
  <table width="490" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="92" height="28" align="right" valign="middle" class="white3"> 主题</td>
      <td width="508" height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="Subject" type="text" id="Subject" size="40" />
        *</td>
    <tr>
      <td height="28" align="right" valign="middle" class="white3">姓名</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="Name" type="text" id="Name" size="40" />
        *</td>
    </tr>
    <tr>
      <td height="28" align="right" valign="middle" class="white3">地址</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="Address" type="text" id="Address" size="40" /></td>
    </tr><tr>
      <td height="28" align="right" valign="middle" class="white3">电话</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="Tel" type="text" id="Tel" size="30" />
        *</td>
    </tr>
    <tr>
      <td height="28" align="right" valign="middle" class="white3">传真</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="Fax" type="text" id="Fax" size="30" />      </td>
    </tr>
    <tr>
      <td height="28" align="right" valign="middle" class="white3">邮编</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="Code" type="text" id="Code" size="10" /></td>
    </tr>
    <tr>
      <td height="28" align="right" valign="middle" class="white3">电子邮箱</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <input name="email" type="text" id="email" size="40" /></td>
    </tr>
    <tr>
      <td height="28" align="right" valign="middle" class="white3">反馈内容</td>
      <td height="28" align="left" valign="middle">&nbsp;&nbsp;
          <textarea name="message" cols="45" rows="6" id="message"></textarea>
        *</td>
    </tr>
    <tr>
      <td height="40" align="right" valign="middle" class="white3">&nbsp;</td>
      <td align="left" valign="middle">&nbsp;&nbsp;
          <input value="提交留言" type="submit" name="cmdOk" onclick="return check()" />
        &nbsp;&nbsp;&nbsp;
        <input value="重写" type="reset" name="cmdReset" />
        <input id="work" type="hidden" value="add" name="work" />      </td>
    </tr>
  </table>
</form>
<?
}
?>